// system.h 
//	All global variables used in Nachos are defined here.
//
// Copyright (c) 1992-1993 The Regents of the University of California.
// All rights reserved.  See copyright.h for copyright notice and limitation 
// of liability and disclaimer of warranty provisions.

#ifndef SYSTEM_H
#define SYSTEM_H
extern int PFIFO;



#include "copyright.h"
#include "utility.h"
#include "thread.h"
#include "scheduler.h"
#include "interrupt.h"
#include "stats.h"
#include "timer.h"

#define swapfile  "swapfile"
#define SWAPPAGENUM 50000
#define PAGENONSWAP -1

#ifdef NETWORK
#define SC_CreateLock	11
#define SC_AcquireLock	12
#define SC_ReleaseLock	13
#define SC_DeleteLock	14
#define SC_CreateCV	15
#define SC_WaitCV	16
#define SC_SignalCV	17
#define SC_BroadcastCV	18
#define SC_DeleteCV	19

#define SCRPC_LOGINON	20
#define SCRPC_CreateMV     21
#define SCRPC_GetMV     22
#define SCRPC_SetMV     23
#define SCRPC_CloseSever     24
#define SC_CV2     25
#define SCRPC_DeleteMV     26

#define SERVER_MSG_MAIL 0

#endif


//extern OpenFile * swapfd;
extern int swapOffset;


// Initialization and cleanup routines
extern void Initialize(int argc, char **argv); 	// Initialization,
						// called before anything else
extern void Cleanup();				// Cleanup, called when
						// Nachos is done.

extern Thread *currentThread;			// the thread holding the CPU
extern Thread *threadToBeDestroyed;  		// the thread that just finished
extern Scheduler *scheduler;			// the ready list
extern Interrupt *interrupt;			// interrupt status
extern Statistics *stats;			// performance metrics
extern Timer *timer;				// the hardware alarm clock
extern int netname;
extern int serverNumber;

#ifdef USER_PROGRAM
#include "machine.h"
extern Machine* machine;	// user program memory and registers
#endif

#ifdef FILESYS_NEEDED 		// FILESYS or FILESYS_STUB 
#include "filesys.h"
#include "openfile.h"
extern FileSystem  *fileSystem;
extern OpenFile * swapfd;
#endif

#ifdef FILESYS
#include "synchdisk.h"
extern SynchDisk   *synchDisk;
#endif

#ifdef NETWORK
#include "post.h"
extern PostOffice* postOffice;
extern unsigned int serversAddr[5];
extern unsigned int serversMail[5];
#endif//

#endif // SYSTEM_H

